<?php
/**
 * LANGUAGE CONFIG
 * 
 * @version 1.0
 * @author thanhnv
 * @desc 21 May 2008
 * @desc config date time format, currency format, ...
 */
define('LANG_FORMAT_DATETIME','m-d-Y H:i:s');
define('LANG_FORMAT_DATE','m-d-Y');
define('LANG_FORMAT_TIME','H:i:s');

define('LANG_FORMAT_CURRENCY','USD ');
define('LANG_FORMAT_CURRENCY_SYMBOL','$ ');

function formatCurrency($price){
	return LANG_FORMAT_CURRENCY . number_format($price, 2, '.', ',');
}
/**
 * format database date time to screen datetime format
 * DB ==> Screen
 */
function formatDateToScreen($sDateTime){
	//return date_format(date_create($sDateTime), 'Y&#24180; m&#26376; d&#26085;');
	return date(LANG_FORMAT_DATE, strtotime($sDateTime));
}
function formatTimeToScreen($sDateTime){
	return date(LANG_FORMAT_TIME, strtotime($sDateTime));
}
function formatDateTimeToScreen($sDateTime){
	return date(LANG_FORMAT_DATETIME, strtotime($sDateTime));
}

/**
 * format screen date time to database datetime format
 * Screen ==> DB
 */
function formatDateTimeToDb($sDateTime){
	return true;
}
/**
 * 
 */
function formatAddress($province='', $city='', $address=''){
	$sAddress = $province;
	if($city != '' && $sAddress != ''){
		$sAddress .= "{$city}";
	}elseif($city != ''){
		$sAddress .= $city;
	}
	
	if($address != '' && $sAddress != ''){
		$sAddress .= "{$address}";
	}elseif($address != ''){
		$sAddress .= $address;
	}
	
	return $sAddress;
}
?>